package com.zfast.yugioh.bo;

import cn.hutool.core.lang.WeightRandom;
import com.zfast.yugioh.constant.DefineEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;


/**
 * 对局数据_Player
 *
 * @author zgn
 * @email
 * @date 2022-06-10 15:16:47
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value = "GameDetailBo", description = "对局数据_Player")
public class GameDetailBo implements Serializable  {

    //region 卡的信息
    @ApiModelProperty("手卡")
    @Builder.Default
    List<CardBo> handCards=new ArrayList<>();

    @ApiModelProperty("场上的卡")
    @Builder.Default
    List<CardBo> liveCards=new ArrayList<>();

    @ApiModelProperty("墓地的卡")
    @Builder.Default
    List<CardBo> graveyardCards=new ArrayList<>();

    @ApiModelProperty("卡组")
    @Builder.Default
    List<CardBo> cards=new ArrayList<>();

    /*@ApiModelProperty("卡组权重")
    @Builder.Default
    List<WeightRandom.WeightObj<CardBo>> weightList= new ArrayList<>();;//卡组权重*/
    //endregion

    //region 角色
    @ApiModelProperty("角色信息")
    UserBo userBo;

    @ApiModelProperty("玩家血量")
    @Builder.Default
    private Integer health= DefineEnum.health.getValue();
    //endregion

    @ApiModelProperty("拓展记录")
    HashMap expandMap = new HashMap();

    /**
     * 展示手卡{0:手卡;1场卡;2墓地;3:卡组}
     * @auther zgn
     * @date  2022/6/10
     **/
    public void showCards(int type){
        StringBuffer doingDecs=new StringBuffer("{");//动作描述
        String[] types={"手卡","场卡","墓地","卡组"};
        doingDecs.append("展示"+types[type]);
        switch (type){
            case 0:
                for (int i = 0; i < handCards.size(); i++) {
                    CardBo card =  handCards.get(i);
                    doingDecs.append(card.getName()+",");
                }
                break;
            case 1:
                for (int i = 0; i < liveCards.size(); i++) {
                    CardBo card =  liveCards.get(i);
                    doingDecs.append(card.getName()+",");
                }
                break;
            case 2:
                for (int i = 0; i < graveyardCards.size(); i++) {
                    CardBo card =  graveyardCards.get(i);
                    doingDecs.append(card.getName()+",");
                }
                break;
            case 3:
                for (int i = 0; i < cards.size(); i++) {
                    CardBo card =  cards.get(i);
                    doingDecs.append(card.getName()+",");
                }
                break;
        }

        doingDecs.append("}");
        System.out.println(doingDecs);

    }
}
